//
//  NOImageCell.m
//  太平洋电脑网
//
//  Created by dllo on 16/6/25.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "NOImageCell.h"

@interface NOImageCell ()
@property (nonatomic,retain)UILabel *titleLable;
@property (nonatomic,retain)UIImageView *firImageView;;
@property (nonatomic,retain)UILabel *firLable;
@property (nonatomic,retain)UILabel *secLable;
@property (nonatomic,retain)UILabel *thiLable;
@end

@implementation NOImageCell
-(void)dealloc{
    [_model release];
    [_titleLable release];
    [_firImageView release];
    [_firLable release];
    [_secLable release];
    [_thiLable release];
    [super dealloc];
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.titleLable = [[UILabel alloc]init];
        [self.contentView addSubview:self.titleLable];
        [_titleLable release];
        self.firLable = [[UILabel alloc]init];
        [self.contentView addSubview:self.firLable];
        [_firLable release];
        self.secLable = [[UILabel alloc]init];
        [self.contentView addSubview:self.secLable];
        [_secLable release];
        self.thiLable = [[UILabel alloc]init];
        [self.contentView addSubview:self.thiLable];
        [_thiLable release];
        self.firImageView = [[UIImageView alloc]init];
        [self.contentView addSubview:self.firImageView];
        self.firImageView.image = [UIImage imageNamed:@"人.png"];
        [_firImageView release];
        UILabel *fouLable = [[UILabel alloc]initWithFrame:CGRectMake(0, 99, 414, 1)];
        [self.contentView addSubview:fouLable];
        fouLable.backgroundColor = [UIColor grayColor];
        [fouLable release];

    }
    return self;
}
- (void)layoutSubviews{
    [super layoutSubviews];
    self.titleLable.frame = CGRectMake(10, 10, 414 - 20, 50);
    self.titleLable.numberOfLines = 0;
    
    self.firImageView.frame = CGRectMake(10, 70, 20, 20);
    self.firLable.frame = CGRectMake(30, 70, 150, 20);
    self.secLable.frame = CGRectMake(180, 70, 100, 20);
    self.thiLable.frame = CGRectMake(280, 70, 404-290, 20);
    
    self.firLable.textColor = [UIColor grayColor];
    self.secLable.textColor = [UIColor grayColor];
    self.thiLable.textColor = [UIColor grayColor];
    self.thiLable.textAlignment = NSTextAlignmentRight;
    
}
- (void)setModel:(Model *)model{
    if (_model !=model) {
        [_model release];
        _model = [model retain];
    }
    self.titleLable.text = model.title;
    self.firLable.text = model.userName;
    NSString *str = [model.lastPostAt substringFromIndex:5];
    NSString *str2 = [str substringToIndex:5];
    self.secLable.text = str2;
    self.thiLable.text = [NSString stringWithFormat:@"%ld阅/%ld回",model.viewCount,model.replyCount];

}




















































@end
